 

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Observable;

public class CelsiusGUI extends TemperatureGUI {

	public CelsiusGUI(TemperatureController controller, int h, int v) {
		super("Celsius Temperature", controller,  h, v);
		addRaiseTempListener(new RaiseTempListener());
		addLowerTempListener(new LowerTempListener());
		addDisplayListener(new DisplayListener());
	}

	public void update(Observable t, Object o) { // Called from the Model
		double temp = ((TemperatureModel) t).getC();
		setDisplay("" + temp);
	}

	class RaiseTempListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			controller().IncrementCelciusTemperature();
		}
	}

	class LowerTempListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			controller().DecrementCelciusTemperature();
		}
	}

	class DisplayListener implements ActionListener {
		public void actionPerformed(ActionEvent e) {
			double value = getDisplay();
			controller().SetCelciusTemperature(value);
		}
	}
}